package com.rupertjones.globalcron;

import org.apache.log4j.Logger;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class GlobalCronStandalone {
    private static final Logger LOG = Logger.getLogger(GlobalCronStandalone.class);

    public static void main(String[] args) {
        GlobalCronStandalone app = new GlobalCronStandalone();
        app.run();
    }

    private void run() {
        Thread.currentThread().setName("GlobalCronStandalone");
        LOG.info("Starting Global Cron Standalone Process...");
        new ClassPathXmlApplicationContext("global-cron-standalone-config.xml");
        boolean interrupted = false;
        try {
            LOG.info("Global Cron Standalone Process running.");
            while (!interrupted) {
                Thread.sleep(10000);
                LOG.trace("Global Cron Standalone Process pulse.");
            }
            LOG.info("Global Cron Standalone Process stopped.");
        } catch (InterruptedException inte) {
            LOG.error(inte);
        }
    }
}
